import { createApp } from "vue";
import Drag from "./dragComponent.vue";
let instance = null;
const drag = createApp(Drag);
const useDrag = {
    install(app: any) {
        instance = app;
        // 这里可以写一些全局的逻辑
        // app.config.globalProperties.$drag = {};
        app.component("Drag", Drag);
        const el = document.createElement("div");
        el.id = "dragId";
        const box = drag.mount(el);
        // document.body.appendChild(box.$el);
        // drag.mount("#app");
        // app.appendComponent("Drag", Drag);
    },
    hidden() {
        // instance.unmountComponent("Drag");
        // drag.unmount();
        document.body?.removeChild(document.getElementById("dragId")!);
    },
    show() {
        const el = document.createElement("div");
        const box = drag.mount(el);
        document.body.appendChild(box.$el);
        // document.getElementById("app")?.appendChild(drag);
        // instance.appendComponent("Drag", Drag);
        // drag.mount("#app");
    },
};
export default useDrag;
